import requests
import time
import execjs

t = str(int(time.time()*1000))
url = 'https://www.jdl.cn/ecology/getSession?_={}'.format(t)
headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
}
res = requests.get(url,headers=headers)
print(res.text)
session = res.json()['obj']
print(session)
# ct = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('data',session)
# print(ct)

# getData
# result = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('getData',session,ct)
# print(result)
session = "F_21AgABAAAAAAAAAAAAMOyNwTt8FTsBGZ4Gne-O9-ior9CW83otYtikjbrkV3Zn4EalRSlZLrGErSAPv9U8gAAAAAA"
ct = "mv5TZH_MbrBOLKvLL1E5_MMG08GYKQiXnMSXF2wmxC_e4T3zfPDMdecGB7FY0a4KF_zqqQ6Z_BSwHEl5OVG2iEvfxXY-vZbt4lkdLhSv0yU1Gfu3vS9rKgXE-PYGFuaWu_naXCYrwqBSLOZiHcQfCgh80LaXK_FuyX735DvHK-NtnVT8GY_CDhQI04fdqEu9lxaDOs4P80e3l0sDwQzmhrvgk8AUmcOeUaO-kRuaoPDL0EdOMuOS4ZOFU5JR6Z0Ig2Xn9d5nofSyn-YzK-SCgjX6as8pdPsAOhmEDCcVPMTLHIlRSGE5HeVpwF0ZXpmbR99lXduHMeI5O_doZjzwbKexe_NKmSfgNaGXRl98mOg_epDLllxAe6nd-hR3-V-v7yASNKPwgtcaHsu9ou4uELhhinr9lNTzj7sPv3E6IjKgVzOrFr6QKU3mmfqZe6KsTllrfhOi1_VHe1r2T4mQVSpnwHdaW3CBJFHbYjTUYsoZM3XXVY_Xp_4xFiIKMhkPpCdMR99LY8Vz7TzNLV-tZY1jSOiCMF8YU6DfnCU1BrJ9pWsn2YhQbRzKMy_t_u5tKBr8skdgqtuxsPtooQaIwYg_6WAZhpcUI3K19SbW7CkJLhK-63iMdUISwLCObYQVC6Gzn3yVs0m5L5rKVNmkptUQjB8GgYAuGlkSDHRncXme6EquTKbRvdJMpes4XdjPeigJhSsWr923wpgJZaY5bjZP4PrgPj7ePhP7aVES6SqowSLESk_21JUwd6QWbo5nlFHqo7HrB8HdjKVw7dFWXHu5zSyFeJuUErdfhNJnI7ZacBrHJ0nv6QzW0_ZqbxSDd3SvksVNywjQmhIBH6J3VfDmnv7JWrAaQZuWLpy6zTvcCgZFgRIgSK0QBdBrQA43chgygijV_qVlN48VexrNLm-mfSAh6U0VMAZacKeXUQAPx-mp79CddScw2LaKMXqbBVPjirof700e0Gb17j7YcKDfi3a2b0RJ7e82iQCgS5MLJZyh7ZLJj5g-gv06vxeAe1Y1Se2aP0Pp3H7IWZfu-5hDXXqtk7DAjuOsWpEfm90obZ9-kheECRHVlGj3BICM1f-yDqFn_QYbClbd4NRZvLO9nqDAWaKW2B9gWyP5qjxhuDM4e7e9ut6Ly4P7VSSYKTdD6xYuKOmWiTIlUm6-QgsWaxRj2zRPhSEj6Yke5XhKEO5OqCo5UFEf6IwsijxisaJLmsq9xeU_mby8x56Qng"
url = 'https://jcap.m.jd.com/cgi-bin/api/fp?si=%s&ct=%s&version=2&lang=1&client='%(session,ct)
# data = {
#     "si":session,
#     "ct":ct,
#     "version":"2",
#     "lang":"1",
#     "client":""
# }
headers = {
    'authority': 'jcap.m.jd.com',
    'method': 'POST',
    'path': '/cgi-bin/api/fp',
    'scheme': 'https',
    'accept': 'application/json, text/plain, */*',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
    'cache-control': 'no-cache',
    'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
    # 'cookie': 'TrackID=1AOoQV0hRXqpw5UZuT1yHAN_zjlg-V9phLoHX6q-_1cd_cf0DPt7sFe8rqCMjaBXUQuIMJAua7OZKP_VTdUDhLNpxXSsGhhWW4QzXGwndQ1I; thor=317DF86A79D04E8215965CA2889DDF81D80BD84BD52113E163E563DD583F746711B8BB41C1E7EF5B61287801D0182A40249ECA97536FF660850EB67EF464936F094983DA656BAF6B1D533760C5AD13F0991892E5CCEFDEBDABF7FA497B52CE744CE7E48915581224CF17BC48C2E19C7AAAF3FEA96359716CBA30221C284F360F; pinId=HmFWFGJN4LdIdSh6p8esqQ; pin=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; unick=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; ceshi3.com=000; _tp=e10oAB9dBLaSDC0YXNjnjTY0Zu1YFrVkJ0SsFh9xVKP2l8IjeMBOZGQ4B9ljV6kr; logining=1; _pst=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93',
    'origin': 'https://www.jdl.cn',
    'pragma': 'no-cache',
    'referer': 'https://www.jdl.cn/',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'cross-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
}
# res = requests.get(url,headers=headers)
# print(res.text)

# url = 'https://jcap.m.jd.com/cgi-bin/api/check'
